class_name Bullet
extends Area2D

@export var speed : float = 900
@export var life_time: float = 1.5
@export var damage := 10.0

var direction : Vector2 = Vector2.ZERO

func _process(delta: float) -> void:
	global_position += direction * speed * delta

func shoot(dir:Vector2) -> void:
	self.direction = dir
	rotation_degrees = rad_to_deg(global_position.angle_to(global_position + dir))

func _on_bullet_out_screen_exited() -> void:
	queue_free()

func _on_bullet_hit_body(body: Node2D) -> void:
	queue_free()
